package sb.simple.schedule.way_static;


import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;

import java.time.LocalDateTime;

/**
 * 静态定时任务，基于注解@Scheduled默认单线程
 */
@Configuration//标记配置类[兼备@Component效果]
@EnableScheduling//开启定时任务
public class StaticScheduleTask {

    @Scheduled(fixedRate = 10000)//添加定时任务
    //@Scheduled(cron = )//支持闹钟模式
    private void task() {
        //System.out.println("静态定时任务:" + LocalDateTime.now());
    }


}
